#include "widget.h"
#include "ui_widget.h"
#include<QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    QDateTime timeold = ui->dateTimeEdit->dateTime();
    QDateTime timenew = ui->dateTimeEdit_2->dateTime();

    //int days = timeold.daysTo(timenew);

    int seconds = timeold.secsTo(timenew);
    int days = (seconds / 3600) / 24;
    int hours = (seconds / 3600) % 24;
    ui->label->setText(QString::number(days) + QString("天零") + QString::number(hours) + QString("小时"));
}
